package com.haotunet.app.goldtreasure.adapter;

import java.util.ArrayList;
import java.util.List;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

public class MainPagerAdapter extends FragmentStatePagerAdapter {
	private List<Fragment> mlist;

	public MainPagerAdapter(FragmentManager fm) {
		super(fm);
		mlist = new ArrayList<Fragment>();
	}

	@Override
	public Fragment getItem(int arg0) {

		return mlist.get(arg0);

	}

	@Override
	public int getCount() {
		if (mlist != null) {
			return mlist.size();
		}
		return 0;
	}

	@Override
	public Object instantiateItem(ViewGroup arg0, int arg1) {
		return super.instantiateItem(arg0, arg1);
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {

		super.destroyItem(container, position, object);
	}

	public void add(Fragment fragment) {
		mlist.add(fragment);
	}
}
